#ifndef GAME_ENTITY_H
#define GAME_ENTITY_H

#include "BackgroundElement.h"

enum entity_type{
	CANDY = 0,
	SPECIAL_CANDY,
	CANDY_COUNT, //I fear this could be misunderstood

	GHOST,
	PACMAN
};

class GameEntity
{
public:
	GameEntity(entity_type nType, int nPoint = 0)
	  :mTileIndex	(-1)
	  ,mCurrentTile	(nullptr)
	  ,mXcoord		(-1)
	  ,mYcoord		(-1)
	  ,mActive		(false)
	  ,mPoint		(nPoint)
	  ,mType		(nType)
	{}



	virtual bool isAPacMan()	const { return (mType == PACMAN);}
			bool isActive()		const { return mActive;			 }
			int	 getXcoord()	const { return mXcoord;			 }
			int	 getYcoord()	const { return mYcoord;			 }
			int  getTileIndex()	const { return mTileIndex;		 }
	entity_type  getType()		const { return mType;			 }
			int  getPoint()		const { return mPoint;			 }

	void setTileIndex(const int tileInd)
	{
		if(tileInd >= 0 )
			mTileIndex = tileInd;
	}
	void setCurrTile(BackgroundElement* nTile) { mCurrentTile = nTile; }
	void setCoord(const int x, const int y)
	{
		if(x >= 0 && y >= 0)
		{
			mXcoord = x; 
			mYcoord = y; 
		}
	};
	virtual void activate()   { if(!this->mActive) this->mActive = true; }
	virtual void deactivate() { if(this->mActive ) this->mActive = false;}
	virtual void collisionWith(GameEntity* entity, bool specialActive = false) = 0;

protected:

	int mXcoord, mYcoord;
	int					mTileIndex;//tileIndex from background ( Background.mBgElements[tileIndex] )
	BackgroundElement*	mCurrentTile;// nevertheless the tile didn't know anything about its proximities

		  bool		  mActive;
	const entity_type mType;
	const int		  mPoint;
};

#endif //GAME_OBJECT_H